package me.shiqiang.im.msg;

import com.fasterxml.jackson.annotation.JsonTypeName;
import me.shiqiang.im.enums.MessageCmd;

/**
 * @author cuishiqiang
 * @date 2017/12/5 下午8:05
 */
@JsonTypeName(value = MessageCmd.NEW_MSG)
public class NewMsg extends Resp {
    private String msg;
    private Long userId;
    private Long syncKey;
    private MsgBody msgBody;


    public NewMsg() {
        setCmd(MessageCmd.NEW_MSG);
    }

    public NewMsg(String msg, Long userId, Long syncKey) {
        setCmd(MessageCmd.NEW_MSG);
        this.msg = msg;
        this.userId = userId;
        this.syncKey = syncKey;
    }

    public NewMsg(Long userId, Long syncKey,MsgBody msgBody) {
        setCmd(MessageCmd.NEW_MSG);
        this.msg = msgBody.getMsg();
        this.userId = userId;
        this.syncKey = syncKey;
        this.msgBody = msgBody;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getSyncKey() {
        return syncKey;
    }

    public void setSyncKey(Long syncKey) {
        this.syncKey = syncKey;
    }

    public MsgBody getMsgBody() {
        return msgBody;
    }

    public void setMsgBody(MsgBody msgBody) {
        this.msgBody = msgBody;
    }


    @Override
    public String toString() {
        return "NewMsg{" +
                "msg='" + msg + '\'' +
                ", userId=" + userId +
                ", syncKey=" + syncKey +
                ", msgBody=" + msgBody +
                "} " + super.toString();
    }
}
